<%
	String serverName = request.getServerName();
	String port = String.valueOf(request.getServerPort());

	String latitude  = request.getParameter("latitude");
	String longitude = request.getParameter("longitude");
	String width = request.getParameter("width");
	String height = request.getParameter("height");
	String contents = request.getParameter("contents").replaceAll("\n","<br/>");
	String zoom = request.getParameter("zoom");
	
	System.out.println("serverName" + serverName);
	System.out.println("port" + port);
	System.out.println("latitude" + latitude);
	System.out.println("longitude" + longitude);
	System.out.println("width" + width);
	System.out.println("height" + height);
	System.out.println("contents" + contents);
	System.out.println("zoom" + zoom);
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<title>약도 만들기</title>
<link rel="stylesheet" type="text/css" href="/map/css/map.css"/>
<script type="text/javascript" src="http://apis.daum.net/maps/maps3.js?apikey=a678b6c21eb9b7a32be8f4c556f0c66715235c29"></script>
<script type="text/javascript" src="/common/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="/map/js/popup.js"></script>
<script type="text/javascript" src="/map/js/map_main.js"></script>
</head>
<body>
<form method="post" name="rvFrm">
<div id="map"></div>
<div id="rv">
	<div id="rvHeader">
		<div id="rvAddr"></div>
		<div id="rvClose"></div>
	</div>
	<iframe src="" id="rv_frame" name="rv_frame" scrolling="no" frameborder="0" width="0" height="0"></iframe>
</div>
</form>
<script type="text/javascript">
window.onload = function() {
	$("#map").width("<%=width%>" + "px");
	$("#map").height("<%=height%>" + "px");
	var po = new daum.maps.LatLng(<%=latitude%>, <%=longitude%>);
	var map = new daum.maps.Map(document.getElementById('map'), { 
		center: po, 
		level : <%=zoom%>,	
		mapTypeId: daum.maps.MapTypeId.ROADMAP 
	});

	daum.maps.event.addListener(map,"click", function(){
		parent.disablePopup();
	});
	
	daum.maps.event.addListener(map,"drag", function(){
		parent.disablePopup();
	});

	/*roadview control*/
	/*
	var roadviewControl = document.createElement("div");

	roadviewControl.id = "btnRVControl";

	roadviewControl.style.backgroundImage= "url(img/btn_rv.png)";
	roadviewControl.style.width = "77px";
	roadviewControl.style.height = "27px";
	roadviewControl.style.cursor = "pointer";
	roadviewControl.style.marginTop = "-5px";
	roadviewControl.style.marginLeft = "-13px";
	
	roadviewControl.onclick = function(ev) {
		rvPreviewSubmit(, , , );
		showPreviewRoadView(, );
	};
	
	map.addControl(roadviewControl, daum.maps.ControlPosition.TOPRIGHT);
	*/

	var btnCloseRv = document.getElementById("rvClose");

	btnCloseRv.onclick = function(ev) {
		hidePreviewRoadView(<%=latitude%>, <%=longitude%>);
	};
	
	var zoomControl = new daum.maps.ZoomControl();
	map.addControl(zoomControl, daum.maps.ControlPosition.RIGHT);
	var mapTypeControl = new daum.maps.MapTypeControl();
	map.addControl(mapTypeControl, daum.maps.ControlPosition.TOPRIGHT);

	var mark = new daum.maps.Marker({
		position : po 
	});
	mark.setMap(map);	

	var con = "<div style='padding:5px;'>" + "<%=contents%>" + "</div>";
	if("" != '' && "" != null && "".length != 0){
		var infoWindow = new daum.maps.InfoWindow({
			position : po,
			content : con,	
			removable : false
		});
		infoWindow.open(map, mark);
	}

	addAddress(<%=latitude%>, <%=longitude%>);
};
</script>
</body>
</html>
